// app/model/ui_config_model.js
'use strict';

module.exports = app => {
  const { STRING, INTEGER, TEXT, DATE } = app.Sequelize;

  const UIConfig = app.model.define('ui_config', {
    id: {
      type: INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    userId: {
      type: INTEGER,
      allowNull: false,
      comment: '用户ID'
    },
    pageKey: {
      type: STRING(100),
      allowNull: false,
      comment: '页面标识符'
    },
    config: {
      type: TEXT,
      allowNull: true,
      comment: '页面配置信息（JSON格式）'
    },
    createdAt: {
      type: DATE,
      allowNull: true,
      comment: '创建时间'
    },
    updatedAt: {
      type: DATE,
      allowNull: true,
      comment: '更新时间'
    }
  }, {
    tableName: 'ui_configs',
    underscored: true,
    comment: '用户界面配置表'
  });

  return UIConfig;
};